package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.factorydata.domain.WorkOrderProcessInfo;
import com.ruoyi.factorydata.mapper.WorkOrderProcessInfoMapper;
import com.ruoyi.factorydata.service.IWorkOrderProcessInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工单工序数据Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-06
 */
@Service
public class WorkOrderProcessInfoServiceImpl extends ServiceImpl<WorkOrderProcessInfoMapper, WorkOrderProcessInfo> implements IWorkOrderProcessInfoService {
    private final WorkOrderProcessInfoMapper workOrderProcessInfoMapper;

    public WorkOrderProcessInfoServiceImpl(WorkOrderProcessInfoMapper workOrderProcessInfoMapper) {
        this.workOrderProcessInfoMapper = workOrderProcessInfoMapper;
    }

    /**
     * 查询工单工序数据
     *
     * @param id 工单工序数据主键
     * @return 工单工序数据
     */
    @Override
    public WorkOrderProcessInfo selectWorkOrderProcessInfoById(Long id) {
        return workOrderProcessInfoMapper.selectWorkOrderProcessInfoById(id);
    }

    /**
     * 查询工单工序数据列表
     *
     * @param workOrderProcessInfo 工单工序数据
     * @return 工单工序数据
     */
    @Override
    public List<WorkOrderProcessInfo> selectWorkOrderProcessInfoList(WorkOrderProcessInfo workOrderProcessInfo) {
        return workOrderProcessInfoMapper.selectWorkOrderProcessInfoList(workOrderProcessInfo);
    }

    /**
     * 新增工单工序数据
     *
     * @param workOrderProcessInfo 工单工序数据
     * @return 结果
     */
    @Override
    public int insertWorkOrderProcessInfo(WorkOrderProcessInfo workOrderProcessInfo) {
                workOrderProcessInfo.setCreateTime(DateUtils.getNowDate());
            return workOrderProcessInfoMapper.insertWorkOrderProcessInfo(workOrderProcessInfo);
    }

    /**
     * 修改工单工序数据
     *
     * @param workOrderProcessInfo 工单工序数据
     * @return 结果
     */
    @Override
    public int updateWorkOrderProcessInfo(WorkOrderProcessInfo workOrderProcessInfo) {
                workOrderProcessInfo.setUpdateTime(DateUtils.getNowDate());
        return workOrderProcessInfoMapper.updateWorkOrderProcessInfo(workOrderProcessInfo);
    }

    /**
     * 批量删除工单工序数据
     *
     * @param ids 需要删除的工单工序数据主键
     * @return 结果
     */
    @Override
    public int deleteWorkOrderProcessInfoByIds(Long[] ids) {
        return workOrderProcessInfoMapper.deleteWorkOrderProcessInfoByIds(ids);
    }

    /**
     * 删除工单工序数据信息
     *
     * @param id 工单工序数据主键
     * @return 结果
     */
    @Override
    public int deleteWorkOrderProcessInfoById(Long id) {
        return workOrderProcessInfoMapper.deleteWorkOrderProcessInfoById(id);
    }
}